﻿using Core.Context;
using Core.IPresentation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tests.Fakes
{
    public class FakeCurrentContext : ICurrentContext
    {
        private List<string> roles;
        private bool isAuthenticated;

        public FakeCurrentContext(bool isAuthenticated, List<string> roles)
        {
            this.isAuthenticated = isAuthenticated;
            this.roles = roles;
        }

        public string UserId { get; set; }

        public string UserName { get; set; }        

        public string Culture { get; set; }        

        public bool IsAuthenticated
        {
            get { return isAuthenticated; }
        }

        public bool IsInRole(string role)
        {
            return roles.Contains(role);
        }

        public IList<string> GetRoles()
        {
            return roles;
        }

        public CurrentContextMemento CreateMemento()
        {
            return new CurrentContextMemento(UserId, Culture, IsAuthenticated, GetRoles());
        }
    }
}
